<table class="table table-condensed table-hover">
<tbody>
    <tr>
        <th colspan="2" class="{{ {True: 'success', False: 'danger'}[resolved] }}">
            {{ _("TT") }}: {{ full_id }}
            <span class="pull-right">
                {% if duration %}{{ duration }}{% endif %}({{ open_ts | timestamp}})
            </span>
        </th>
    </tr>
    <tr>
        <th scope="row">{{ _("Stage") }}</th>
        <td>
            {{ stage }}
            <span class="pull-right">
                {% if owner %}
                    <span class="label label-primary">{{ owner }}</span>
                {% endif %}
                ({{ stage_ts | timestamp }})
            </span>
        </td>
    </tr>
    {% if alarms %}
    <tr>
        <th scope="row">{{ _("Alarms") }}</th>
        <td>
            <table class="table table-condensed">
                <thead>
                    <tr>
                        <th>{{ _("Timestamp") }}</th>
                        <th>{{ _("Object") }}</th>
                        <th>{{ _("Duration") }}</th>
                        <th>{{ _("Subject") }}</th>
                        <th>{{ _("Services") }}</th>
                    </tr>
                </thead>
                <tbody>
                    {% for a in alarms %}
                    <tr>
                        <td><a href="/api/card/view/alarm/{{ a["id"] }}/">{{ a["timestamp"] | timestamp}}</a></td>
                        <td><a href="/api/card/view/managedobject/{{ a["alarm"].managed_object.id }}/">{{ a["alarm"].managed_object.name }}</a></td>
                        <td>{{ a["duration"] }}</td>
                        <td>{{ a["subject"] }}</td>
                        <td>{{ a["summary"] | glyph_summary }}</td>
                    </td>
                    {% endfor %}
                </tbody>
            </table>
        </td>
    <td>
    {% endif %}
    {% if pre_reason %}
    <tr>
        <th scope="row">{{ _("Pre Reason") }}</th>
        <td>{{ pre_reason }}</td>
    </tr>
    {% endif %}
    {% if final_reason %}
    <tr>
        <th scope="row">{{ _("Final Reason") }}</th>
        <td>{{ final_reason }}</td>
    </tr>
    {% endif %}
    <tr>
        <th scope="row">{{ _("Description") }}</th>
        <td>
            <div class="panel panel-default">
                {% if subject %}
                <div class="panel-heading">
                    {{ subject | e }}
                </div>
                {% endif %}
                <div class="panel-body" style="white-space: pre-line">
                    {{ body | e }}
                </div>
            </div>
        </td>
    </tr>
    {% if comments %}
    <tr>
        <th scope="row">{{ _("Comments") }}</th>
        <td>
            {% for c in comments %}
                <div class="panel panel-default">
                    <div class="panel-heading">
                        {% if c["subject"] %}{{ c["subject"] | e }}{% endif %}
                        <span class="pull-right">
                            {% if c["login"] %}
                                <span class="label label-primary">{{ c["login"] }}</span>
                            {% endif %}
                            ({{ c["ts"] }})
                        </span>
                    </div>
                    <div class="panel-body" style="white-space: pre-line">
                        {{ c["body"] | e }}
                    </div>
                </div>
            {% endfor %}
        </td>
    </tr>
    {% endif %}
</tbody>
</table>
